package com.sky.controller.admin;

import com.sky.result.Result;
import com.sky.service.ShopService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController("adminShopController")
@RequestMapping("/admin/shop")
@Slf4j
@Api(tags = "营业状态接口")
public class ShopController {
    @Autowired
    private ShopService shopService;

    @ApiOperation("营业状态查询")
    @GetMapping("/status")
    public Result<Integer> GetStatus() {
        log.info("营业状态查询");
        int status = shopService.getStatus();
        return Result.success(status);
    }

    @ApiOperation("营业状态设置")
    @PutMapping("/{status}")
    public Result gaiShop(@PathVariable int status){
        log.info("修改营业状态{}",status);
        shopService.gaiStatus(status);
        return Result.success();
    }
}
